<?php


namespace app\admin\controller;

use app\logic\DataHelper;
use think\facade\Cache;
use think\facade\Db;
use think\facade\View;

class Base
{
    public function __construct()
    {

        $admin = get_curr_admin();
        $baseUrl = request()->baseUrl();
        View::assign('admin', $admin);

        $no_login_actions = [ '/admin/frame/login','/admin/frame/login_submit' ];


        if (!$this->is_login() && !in_array($baseUrl, $no_login_actions)) {
            //echo 'ssssssssssssssss';
            //return redirect('/admin/frame/login');
            echo "<script>location.href='/admin/frame/login'</script>";
            exit(0);
        }
    }

    public function is_login() {
        return !empty(get_curr_admin());
    }
}